package com.lagou.homework4;

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;

public class InputTextTest {
    public static void main(String[] args) throws IOException {
        BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
        PrintStream bw1 = new PrintStream(new FileOutputStream("abc.txt"));


        ArrayList<String> strarr = new ArrayList<String>();
//        Boolean isBye = true;
        while (true){
            String s1 = br1.readLine();
            if ("bye".equals(s1)){
                System.out.println("结束循环");
//                isBye = false;
                break;
            }
            strarr.add(s1);
        }

        Collections.sort(strarr);
        Iterator<String> iterator = strarr.iterator();
        while (iterator.hasNext()){

            bw1.println(iterator.next());

        }

    }
}
